import * as types from './action-types';
function connectRouter(history) {
    const initialState = {
        location: history.location,
        action: history.action
    }
    // 返回一个reducer
    return function (state = initialState, action) {
        // 如果是触发路由action，则覆盖老状态的路由信息
        if (action.type === types.LOCATION_CHANGE) {
            return { ...state, ...action.payload };
        } else {
            return state;
        }
    }
}

export default connectRouter;
